<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text"> <img src="./睁眼.png">

</body>
</html>
<script>
    var mm=document.querySelector("input");
    var img=document.querySelector("img")
    var flag=1;
    img.onclick=function(){
        if(flag==1){
            mm.type='password';
            img.src='./闭眼.png';
            flag=0;
        }else{
            mm.type='text';
            img.src='./睁眼.png';
            flag=1;
        }
    }
    
</script>